<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@include file="/WEB-INF/commons/taglibs.jsp"%>
<%@include file="/WEB-INF/commons/common-header.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
	$(function() {
		$("#add").click(function() {
			location.href = "${ctx}/security/role/create";
		});

		$("#del")
				.click(
						function() {
							var items = GrayPlane.select();
							if (items && items.length > 0
									&& confirm("你确定要删除这些内容吗?")) {

								$('input[name="_method"]').remove();
								$("#myForm")
										.attr("action",
												"${ctx}/security/role/delete")
										.attr("method", "post")
										.append(
												'<input type="hidden" name="_method" value="DELETE" />')
										.submit();
								//加了这句之后 下面那就不在执行
								return false;
							}

							alert("请先选择要删除的内容");
							return false;
						});
	});
</script>
</head>
<body>
	<form id="myForm" action="${ctx }/security/role/list" method="get">
		<ul class="s_bodyR">
			<li class="s_li_head">用户管理&gt;角色管理</li>
			<li class="s_brSearch" style="display: none;"><span class="s_brsData">数据显示</span>
			<span class="s_brsName">姓名：<input type="text" value="输入姓名或ID" /></span>
			<span class="s_brsButton"><input class="search_submit_btn" type="submit" value="提 交" /></span>
			<%-- <span class="dist">名称：</span><input name="params[name]" value="${page.params.name}" type="text" /><input class="tjbtn" type="submit" value="提交" /> --%>
			<p>${message.text }</p></li>
			<li class="s_brTable">
				<table width="100%" border="0" cellspacing="0">
					<tr>
						<th width="5%"><jsp:include
								page="/WEB-INF/commons/checkall.jsp"></jsp:include>&nbsp;</th>
						<th width="8%" scope="col">角色名称</th>
						<th width="8%" scope="col">名称</th>
						<th width="6%" class="s_brtableTD2" scope="col">基本操作</th>
					</tr>
					<c:choose>
						<c:when test="${not empty page.result }">
							<c:forEach items="${page.result }" var="role">
								<tr>
									<td style="border-left: 0;"><input type="checkbox"
										name="items" id="checkbox" value="${role.id}" /></td>
									<td>${role.showName}&nbsp;</td>
									<td>${role.name }&nbsp;</td>
									<td class="s_brtableTD2"><shiro:hasRole name="admin">
											<a href="${ctx }/security/role/${role.id}/edit"><span
												class="s_brtReady">编辑</span></a>
										</shiro:hasRole> &nbsp;</td>
								</tr>
							</c:forEach>
						</c:when>
						<c:otherwise>
							<tr>
								<td colspan="7" align="center"><b>暂无内容</b></td>
							</tr>
						</c:otherwise>
					</c:choose>
				</table>
			</li>
			<li class="s_brPage">
				<p class="s_brpLeft">
					<!-- <label><input type="checkbox" />全选</label>
				<button class="s_button">批量有效</button> -->
				<shiro:hasRole name="admin">
					<label><a id="add" href="#">新增</a></label>
					<button class="s_button" id="del">批量删除</button>
				</shiro:hasRole>
				</p>
				<p class="s_brpRight">
					<!--page start--><jsp:include page="/WEB-INF/commons/page.jsp" /><!--page end-->
				</p>
			</li>
		</ul>
	</form>
</body>
</html>